#pragma once
#include <sys/time.h>
#include <list>
#include <string>
#include <boost/function.hpp>

namespace sevent{


class Server;
class Connect;
class Task {
public:
	typedef boost::function <int(Connect*, char*)> TaskFunc;
	
	Task(Connect* c, char* buf, const TaskFunc& f);
	~Task();
	
	int execute();
//	int reset();
	struct timeval &createTime() {
		return _createTime;
	}

	Connect* connect(){return _connect;}
private:
	Connect* _connect;
	char* _message;

	TaskFunc _taskFunc;

	struct timeval _createTime;

	Task(const Task & other);
	Task & operator =(const Task & other);
};


}


